cmake_minimum_required(VERSION 3.17)
set(CMAKE_CXX_STANDARD 17)
SET(PROJECT_NAME otest)
project(${PROJECT_NAME})
include_directories(
${PROJECT_SOURCE_DIR}/include/
) #包含源路径下的所有的头⽂件
#包含opencv绝对路径
# SET(OpenCV_DIR D:/opencv-4.5.2/opencv/MingwBuild/install)##这⾥标明编译好的opencv

find_package( OpenCV REQUIRED ) ##找寻路径下的所需⽂件

include_directories( ${OpenCV_INCLUDE_DIRS}) #包含opencv库⽬录
#打印调试信息
MESSAGE(STATUS "Project: ${PROJECT_NAME}")
MESSAGE(STATUS "OpenCV library status:")
MESSAGE(STATUS " version: ${OpenCV_VERSION}")
MESSAGE(STATUS " libraries: ${OpenCV_LIBS}")
MESSAGE(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
aux_source_directory(src DIR_SRCS) ##⾃动搜寻指定⽬录下的所有需

#打印调试src获取的⽂件
MESSAGE(STATUS "Src file: ${DIR_SRCS}")
#编译添加可执⾏程序，命名为project name
add_executable(${PROJECT_NAME}
main.cpp
${DIR_SRCS}
) ##添加可执⾏⽬标
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ) ##链接opencv库

